import Clipboard from "clipboard";
import { Message } from "element-ui";
export function handleClipboard(event, text, successMsg, errorMsg) {
  const clipboard = new Clipboard(event.target, {
    text: () => text,
  });
  clipboard.on("success", () => {
    Message.success({ message: successMsg || "复制成功", showClose: true });
    clipboard.destroy();
  });
  clipboard.on("error", () => {
    Message.warning({ message: errorMsg || "复制失败", showClose: true });
    clipboard.destroy();
  });
  clipboard.onClick(event);
}
